package com.flying.invest.stat.service;

import com.flying.common.annotation.DaoQuery;
import com.flying.common.util.Codes;
import com.flying.framework.annotation.MethodInfo;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Service;
import com.flying.framework.context.ServiceContext;
import com.flying.framework.model.ModelFactory;
import com.flying.framework.model.QueryResult;
import com.flying.framework.service.AbstractService;
import com.flying.invest.stat.model.WaveStrategyMonthStat;

@Service(value="WaveStrategyMonthStatService", desc="阶段策略统计")
public class WaveStrategyMonthStatService extends AbstractService{

	@SuppressWarnings("unchecked")
	@MethodInfo("搜索")
	@DaoQuery(entity=WaveStrategyMonthStat.ENTITY_NAME, pageable=true, modelClass=WaveStrategyMonthStat.class)
	public QueryResult<WaveStrategyMonthStat> findAll(
			@Param(value=WaveStrategyMonthStat.USER_ID, required=false,	desc="所属用户") Long user_id,
			@Param(value=WaveStrategyMonthStat.TYPE_ID, required=false,	desc="策略类型") Long type_id,
			@Param(value=WaveStrategyMonthStat.MONTH, required=false,	desc="统计月份") String month,
			@Param(value=Codes.PAGE_NUM, 	required=false, desc="分页页号，默认0") int page,
			@Param(value=Codes.PAGE_SIZE, 	required=false, desc="分页大小，默认10") int rows) {
		if(user_id == null) {
			var p = ServiceContext.getContext().getPrincipal();
			user_id = Long.parseLong(p.getId());
		}
		return ModelFactory.create(QueryResult.class, WaveStrategyMonthStat.USER_ID, user_id);
	}
}